package by.demchenko.sample.webapp.page.home.panel;

import by.demchenko.sample.webapp.app.BasicAuthenticationSession;
import by.demchenko.sample.webapp.app.WicketWebApplication;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

import java.util.Locale;

public class LanguagePanel extends Panel {

    public LanguagePanel(String id) {
        super(id);
        add(new Link("ru") {
            @Override
            public void onClick() {
                getSession().setLocale(new Locale("ru", "RU"));
                setResponsePage(WicketWebApplication.get().getHomePage());
            }
        });

        add(new Link("en") {
            @Override
            public void onClick() {
                getSession().setLocale(new Locale("en", "US"));
                setResponsePage(WicketWebApplication.get().getHomePage());
            }
        });

    }
}
